public class Swapper
{
   /**
      This method swaps the first and second half of the given array.
      @param values an array
   */
   public void swapFirstAndSecondHalf(int[] values)
   {
      int n=values.length;
      if(n%2==0)
      {
         for(int i=0;i<n/2;i++){
            int x=values[i];
            values[i] = values[n/2+i];
            values[n/2+i]=x;
         }
      }
      else{
         for(int i=0;i<n/2;i++){
            int x=values[i];
            values[i]=values[n/2+1+i];
            values[n/2+1+i]=x;
         }
      }
   }
   
   
   // This method is used to check your work
   public int[] check(int[] values)
   {
      swapFirstAndSecondHalf(values);
      return values;
   }
}
